package com.yinNuo.collectWool.mobileApi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yinNuo.collectWool.collectWoolHttp.JiuZhangHeadlinesHttps;
import com.yinNuo.collectWool.core.constant.Costant;
import com.yinNuo.collectWool.mobileApi.entity.User;
import com.yinNuo.collectWool.mobileApi.entity.UserDoTask;
import com.yinNuo.collectWool.mobileApi.service.IndexService;
import com.yinNuo.collectWool.mobileApi.service.UserDoTaskService;
import com.yinNuo.collectWool.utils.ToolUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: yinNuo
 * create at: 2022/12/15 15:25
 * @description:
 */
@Service
public class IndexServiceImpl implements IndexService {
    @Autowired
    private JiuZhangHeadlinesHttps jiuZhangHeadlinesHttps;
    @Resource
    private UserDoTaskService userDoTaskService;
    @Autowired
    private User user;

    /**
     * 获取用户信息详情
     *
     * @return
     */
    @Override
    public Map<String, Object> getPersonMessage() {
        List<UserDoTask> list = userDoTaskService.list(new QueryWrapper<UserDoTask>().eq("wool_task_id", Costant.JIUZHANG_ID));
        Map<String, Object> map = new HashMap<>();
        for (UserDoTask userDoTask : list) {
            if (userDoTask.getWoolTaskDetailId() == 1) {
                if (ToolUtil.isNotEmpty(userDoTask.getToken())) {
                    map = jiuZhangHeadlinesHttps.getPersionalMessage(userDoTask.getToken());
                    return map;
                }
            }
        }
        return map;
    }
}
